<?php
namespace app\index\controller;
use think\facade\Db;
use think\facade\Request;
use think\facade\View;

class Order{
    public function orderList()
    {

//        ===============搜索
        $keywords = input('keywords');
        $where=[];
        if(isset($keywords) && $keywords <> ""){$where=[['order_sn','like',"%{$keywords}%"]];};
        View::assign('keywords',$keywords);


//        ================订单状态
        $get = Request::get();
        if(isset($get['dd']) && $get['dd'] <> ""){$where=[['status','in',$get['dd']]];};


//        ===============金额

        if(isset($get['jin']) && $get['jin'] <> "" && isset($get['jin1']) && $get['jin1'] <> ""){$where=[['price','between',"{$get['jin']},{$get['jin1']}"]];};

//        ===============时间
        if(isset($get['sj1']) && $get['sj1'] <> "" && isset($get['sj2']) && $get['sj2'] <> ""){$where=[['addtime','between time',"{$get['sj1']},{$get['sj2']}"]];};

        View::assign($get);


        $sql=Db::table('ecm_order')->where($where)->select();
        View::assign('list',$sql);
        $fh=Db::table('ecm_order_status')->select();
        View::assign('fh',$fh);
        $hy=Db::table('ecm_user')->select();
        View::assign('hy',$hy);
        return View();
    }
    public function orderDetail()
    {
        return View();
    }
}